﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace music_player
{
    public class TimeSpanConverter : IValueConverter
    {

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            int m = System.Convert.ToInt32(value);
            int minute = m / 60, second = m % 60;
            string result = "";
            if (minute < 10)
                result += '0';
            result += minute + ":";
            if (second < 10)
                result += '0';
            result += second + "";
            return result;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return value;
        }
    }
}
